#pragma once
#include <dxstdafx.h>

template <class type> class Vector {

public:
	Vector() {
		m_Total = 0;
		m_Data = 0;
	}
	Vector(uint32 total) {
		m_Total = total;
		m_Data = new type[ total ];
	}
	Vector(uint32 total,const type& clearValue) {
		m_Total = total;
		m_Data = new type[ total ];
		clear(clearValue);
	}
	~Vector() {
		if ( m_Data != 0 ) {
			delete[] m_Data;
		}
	}
	void clear(const type& t) {
		uint32 sz = m_Total;
		if ( sz > 0 ) {
			for ( uint32 i = 0; i < sz; ++i ) {
				m_Data[i] = t;
			}
		}
	}
	type& get(uint32 idx) {
		return m_Data[idx];
	}
	void set(uint32 idx,const type& t) {
		m_Data[idx] = t;
	}
	uint32 size() const {
		return m_Total;
	}	
	bool isValid(int idx) const {
		if ( idx < 0 ) {
			return false;
		}
		if ( idx > m_Total ) {
			return false;
		}
		return true;
	}
private:
	uint32 m_Total;
	uint32 m_Size;
	type* m_Data;
};